//
//  @ Project : Galaxy Star Trading System
//  @ File Name : SeriesBase.h
//  @ Date : 2014/9/5
//  @ Author :
//
//
#if !defined(_CSERIESBASE_H)
#define _CSERIESBASE_H

namespace GSTrader
{
	namespace Indicator
	{
		class CIndicator;

		class INDICATOR_API CSeries
		{
		public:
			CSeries();
			CSeries(const CSeries& Series);
			CSeries& operator= (const CSeries& Series);
			virtual ~CSeries();

		public:
			virtual CTimePoint GetDateTime(uint32 nIndex);
			virtual int GetIndex(CTimePoint dateTime, SeriesIndexOption option = SeriesIndexOption::sioNull);
			virtual int GetIndex(CTimePoint dateTime, SeriesSearchOption option = SeriesSearchOption::ssoPrev);
			virtual double GetMax(CTimePoint t1, CTimePoint t2);
			virtual double GetMax(int nStart, int nEnd, int bardata);
			virtual double GetMin(CTimePoint t1, CTimePoint t2);
			virtual double GetMin(int nStart, int nEnd, int bardata);
			virtual int GetCount();
			virtual string GetDescription();
			virtual string GetName();
			virtual double GetFirstValue();
			virtual double GetLastValue();
			virtual CTimePoint GetLastDateTime();
			virtual CTimePoint GetFirstDateTime();
			virtual int GetIndicators(const vector<CIndicator*>& vIndicator);
			void AddIndicator(CIndicator* pIndicator);
			void RemoveIndicator(CIndicator* pIndicator);
			virtual double GetValue(int index, int bardata);
			virtual double GetValueByIndex(int index);

			double operator[](int nIndex);

			double At(int nIndex);
		private:
			void Release();

		public:
			list<CIndicator*> m_lIndicator;
			int m_nStartIndex;
		public:
			string m_strname;
			string m_strDescription;
		};


	}
}
#endif // _CSERIESBASE_H